<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link type="text/css" rel="stylesheet" href="css/style.css"/>
    <!--[if IE 6]>
    <script src="js/iepng.js" type="text/javascript"></script>
    <script type="text/javascript">
        EvPNG.fix('div, ul, img, li, input, a');
    </script>
    <![endif]-->
    <script type="text/javascript" src="js/jquery-1.11.1.min_044d0927.js"></script>
    <script type="text/javascript" src="js/jquery.bxslider_e88acd1b.js"></script>

    <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="js/menu.js"></script>

    <script type="text/javascript" src="js/select.js"></script>

    <script type="text/javascript" src="js/lrscroll.js"></script>

    <script type="text/javascript" src="js/iban.js"></script>
    <script type="text/javascript" src="js/fban.js"></script>
    <script type="text/javascript" src="js/f_ban.js"></script>
    <script type="text/javascript" src="js/mban.js"></script>
    <script type="text/javascript" src="js/bban.js"></script>
    <script type="text/javascript" src="js/hban.js"></script>
    <script type="text/javascript" src="js/tban.js"></script>
    <script type="text/javascript" src="js/lrscroll_1.js"></script>
    <script type="text/javascript" src="js/vue.min.js"></script>
    <script type="text/javascript" src="js/axios.min.js"></script>

    <title>尤洪</title>
</head>
<body>
<!--Begin Header Begin-->
<div class="soubg">
    <div class="sou">
        <!--Begin 所在收货地区 Begin-->
        <span class="s_city_b">
        	<span class="fl">送货至：</span>
            <span class="s_city">
            	<span>四川</span>
                <div class="s_city_bg">
                	<div class="s_city_t"></div>
                    <div class="s_city_c">
                    	<h2>请选择所在的收货地区</h2>
                        <table border="0" class="c_tab" style="width:235px; margin-top:10px;" cellspacing="0"
                               cellpadding="0">
                          <tr>
                            <th>A</th>
                            <td class="c_h"><span>安徽</span><span>澳门</span></td>
                          </tr>
                          <tr>
                            <th>B</th>
                            <td class="c_h"><span>北京</span></td>
                          </tr>
                          <tr>
                            <th>C</th>
                            <td class="c_h"><span>重庆</span></td>
                          </tr>
                          <tr>
                            <th>F</th>
                            <td class="c_h"><span>福建</span></td>
                          </tr>
                          <tr>
                            <th>G</th>
                            <td class="c_h"><span>广东</span><span>广西</span><span>贵州</span><span>甘肃</span></td>
                          </tr>
                          <tr>
                            <th>H</th>
                            <td class="c_h"><span>河北</span><span>河南</span><span>黑龙江</span><span>海南</span><span>湖北</span><span>湖南</span></td>
                          </tr>
                          <tr>
                            <th>J</th>
                            <td class="c_h"><span>江苏</span><span>吉林</span><span>江西</span></td>
                          </tr>
                          <tr>
                            <th>L</th>
                            <td class="c_h"><span>辽宁</span></td>
                          </tr>
                          <tr>
                            <th>N</th>
                            <td class="c_h"><span>内蒙古</span><span>宁夏</span></td>
                          </tr>
                          <tr>
                            <th>Q</th>
                            <td class="c_h"><span>青海</span></td>
                          </tr>
                          <tr>
                            <th>S</th>
                            <td class="c_h"><span>上海</span><span>山东</span><span>山西</span><span class="c_check">四川</span><span>陕西</span></td>
                          </tr>
                          <tr>
                            <th>T</th>
                            <td class="c_h"><span>台湾</span><span>天津</span></td>
                          </tr>
                          <tr>
                            <th>X</th>
                            <td class="c_h"><span>西藏</span><span>香港</span><span>新疆</span></td>
                          </tr>
                          <tr>
                            <th>Y</th>
                            <td class="c_h"><span>云南</span></td>
                          </tr>
                          <tr>
                            <th>Z</th>
                            <td class="c_h"><span>浙江</span></td>
                          </tr>
                        </table>
                    </div>
                </div>
            </span>
        </span>
        <!--End 所在收货地区 End-->
        <span class="fr">
        	<span class="fl" v-show="loginUser===''">你好，请<a href="Login.html">登录</a>&nbsp;
                <a href="Regist.html" style="color:#ff4e00;">免费注册</a>&nbsp;|&nbsp;
            </span>
            <span class="fl" v-show="loginUser!==''">
                 <a href="JavaScript:void(0)">我的订单</a>&nbsp;|
                 <a href="JavaScript:void(0)">后台</a>&nbsp;|
                 <a href="JavaScript:void(0)">注销</a>&nbsp;|
            </span>
        	<span class="ss">
            	<div class="ss_list">
                	<a href="#">收藏夹</a>
                    <div class="ss_list_bg">
                    	<div class="s_city_t"></div>
                        <div class="ss_list_c">
                        	<ul>
                            	<li><a href="#">我的收藏夹</a></li>
                                <li><a href="#">我的收藏夹</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="ss_list">
                	<a href="#">客户服务</a>
                    <div class="ss_list_bg">
                    	<div class="s_city_t"></div>
                        <div class="ss_list_c">
                        	<ul>
                            	<li><a href="#">客户服务</a></li>
                                <li><a href="#">客户服务</a></li>
                                <li><a href="#">客户服务</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="ss_list">
                	<a href="#">网站导航</a>
                    <div class="ss_list_bg">
                    	<div class="s_city_t"></div>
                        <div class="ss_list_c">
                        	<ul>
                            	<li><a href="#">网站导航</a></li>
                                <li><a href="#">网站导航</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </span>
            <span class="fl">|&nbsp;关注我们：</span>
            <span class="s_sh"><a href="#" class="sh1">新浪</a><a href="#" class="sh2">微信</a></span>
            <span class="fr">|&nbsp;<a href="#">手机版&nbsp;<img src="images/s_tel.png" align="absmiddle"/></a></span>
        </span>
    </div>
</div>
<!--End Header End-->
<!--Begin Login Begin-->
<div class="log_bg">
    <div class="top">
        <div class="logo"><a href="Index.html"><img src="images/logo.png"/></a></div>
    </div>
    <div class="login">
        <div>
            <table border="0" style="width:400px; font-size:14px; margin-top:30px;" cellspacing="0" cellpadding="0">
                <tr height="50" valign="top">
                    <td width="95">&nbsp;</td>
                    <td>
                        <span class="fl" style="font-size:24px;">重置密码</span>
                    </td>
                </tr>
                <tr height="70">
                    <td>密&nbsp;&nbsp;&nbsp; &nbsp; 码</td>
                    <td><input type="password" v-model="opwd" class="l_pwd"/></td>
                </tr>
                <tr height="70">
                    <td>确认密码</td>
                    <td><input type="password" v-model="npwd" class="l_pwd"/></td>
                </tr>
                <tr height="60">
                    <td>&nbsp;</td>
                    <td><input type="button" value="保存" class="log_btn" @click="resetpwd()"/></td>
                </tr>
            </table>
        </div>
    </div>
</div>
<!--End Login End-->
<!--Begin Footer Begin-->
<div class="btmbg">
    <div class="btm">
        备案/许可证编号：蜀ICP备12009302号-1-www.dingguagua.com Copyright © 2015-2018 尤洪商城网 All Rights Reserved. 复制必究 , Technical
        Support: Dgg Group <br/>
        <img src="images/b_1.gif" width="98" height="33"/><img src="images/b_2.gif" width="98" height="33"/><img
            src="images/b_3.gif" width="98" height="33"/><img src="images/b_4.gif" width="98" height="33"/><img
            src="images/b_5.gif" width="98" height="33"/><img src="images/b_6.gif" width="98" height="33"/>
    </div>
</div>
<!--End Footer End -->

<script type="text/javascript">
    new Vue({
        el: ".soubg",
        data: {
            loginUser: "",
        },
        created() {
            axios("index/getUser").then(res => {
                this.loginUser = res.data;
                console.log(this.loginUser);
                if (this.loginUser !== '') {
                    alert("已经登陆过了！");
                    window.location.href = "Index.html";
                }
            })
        },
        methods: {}
    });

    var vm = new Vue({
        el: '.log_bg',
        data: {
            opwd: '',
            npwd: '',
            userId: ''
        },
        created() {
            var url = window.location.href;
            var arr = url.split("=");
            var cid = decodeURI(arr[1]);
            this.userId = cid;
            this.checkRedis(cid);
        },
        methods: {
            checkRedis(id) {
                console.log(id);
                if (id === 'undefined') {
                    alert("没有邮箱验证，去验证邮箱");
                    window.location.href = "FindPwd_Email.html";
                } else {
                    axios("/index/checkRedis/" + id).then(res => {
                        if (!res.data) {
                            alert("没有邮箱验证，去验证邮箱");
                            window.location.href = "FindPwd_Email.html";
                        }
                    })
                }
            },
            checkPwd(str) {//密码验证 6到16位（字母，数字）
                var re = /^[a-zA-Z0-9]{6,16}$/;
                if (re.test(str)) {
                    return true;
                } else {
                    return false;
                }
            },
            isEmpty(obj) {//判断是否为空
                var regu = "^[ ]+$";
                var re = new RegExp(regu);
                if (typeof obj == "undefined" || obj == null || obj == "" || re.test(obj)) {
                    return true;
                } else {
                    return false;
                }
            },
            checkopwd() {
                var ms = '';
                if (this.isEmpty(this.opwd)) {
                    ms = '密码不能为空';
                } else if (!this.checkPwd(this.opwd)) {
                    ms = '密码不符合要求，密码只能由6到16位字母，数字组成';
                } else {
                    return true;
                }
                alert(ms);
                return false;

            },
            checknpwd() {
                var ms = '';
                if (this.isEmpty(this.npwd)) {
                    ms = '密码不能为空';
                } else if (!this.checkPwd(this.npwd)) {
                    ms = '密码不符合要求，密码只能由6到16位字母，数字组成';
                } else if (this.opwd != this.npwd) {
                    ms = '两次输入的密码不一致';
                } else {
                    return true;
                }
                alert(ms);
                return false;
            },
            resetpwd() {
                if (!this.checkopwd()) {
                    return false;
                }
                if (!this.checknpwd()) {
                    return false;
                }
                axios({
                    url: "index/resetPwd",
                    method: "post",
                    data: {
                        id: this.userId,
                        password: this.npwd
                    }
                }).then(rs => {
                    console.log(rs.data);
                    if (rs.data === "yes") {
                        alert("密码重置成功，去登录吧！");
                        window.location.href = "Login.html";
                    } else {
                        alert("密码重置失败！");
                    }
                })
            }
        }
    })
</script>
</body>


<!--[if IE 6]>
<script src="//letskillie6.googlecode.com/svn/trunk/2/zh_CN.js"></script>
<![endif]-->
</html>
